"""
数据格式化工具
"""
from datetime import datetime
from typing import Any, Dict, List, Union


def format_date(date_str: str, input_format: str = "%Y-%m-%d", output_format: str = "%Y年%m月%d日") -> str:
    """
    格式化日期字符串
    """
    date_obj = datetime.strptime(date_str, input_format)
    return date_obj.strftime(output_format)


def format_currency(value: Union[int, float], currency: str = "¥") -> str:
    """
    格式化货币
    """
    return f"{currency}{value:,.2f}"


def format_list_to_string(items: List[Any], separator: str = ", ") -> str:
    """
    将列表格式化为字符串
    """
    return separator.join(str(item) for item in items)